package com.example.aijie.autoreadhelper.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.widget.ListView;

import com.example.aijie.autoreadhelper.R;
import com.example.aijie.autoreadhelper.adapter.SetAdapter;
import com.example.aijie.autoreadhelper.appbean.BaseAppBean;
import com.example.aijie.autoreadhelper.constant.AppConstant;
import com.example.aijie.autoreadhelper.utils.LogUtils;

import org.litepal.LitePal;
import org.litepal.crud.callback.SaveCallback;

import java.util.ArrayList;
import java.util.List;

/**
 * 设置页面
 */
public class SetActivity extends AppCompatActivity {
    private List<BaseAppBean> appBeanList;
    private SetAdapter adapter;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_set);

        initView();

        initData();
    }

    private void initView() {
        ListView listView = (ListView) findViewById(R.id.listView);
        appBeanList = new ArrayList<>();
        adapter = new SetAdapter(appBeanList, this);
        listView.setAdapter(adapter);

    }

    private void initData() {
        appBeanList.addAll(LitePal.findAll(BaseAppBean.class));
        adapter.notifyDataSetChanged();
    }
}
